HIV incidence among gay, bisexual and other men who have sex with men (hereafter MSM) continues to rise, driven in part by substance use. MSM are increasingly using social networking sites (SNS) to find substance use and sexual partners. However, no studies currently exist that use automated, real-time data collection and analysis procedures to monitor substance use and sexual partner seeking across the range of SNS platforms used by MSM to inform intervention development. This project will build on Routine Activities Theory to conduct research using SNS interactions to aid in understanding patterns of substance use and HIV risk behavior among MSM. During Phase 1, focus groups of MSM (n=~8/focus group; N=24) will be used to develop a lexicon for identifying substance use and sexual partner seeking among MSM via diverse SNS platforms. These findings will guide the development of a culturally congruent data collection and mining module (DCMM; internet software that systematically searches SNS to gather data in an analyzable format) with iterative feedback from a community advisory board (CAB) and pilot testing by MSM (n=6). During Phase 2, the DCMM will gather data from 50 MSM on SNS use (e.g., frequency, intensity) substance use and HIV risk/protective behaviors (e.g., content of profiles, postings). Risk behaviors will be assessed weekly via self- report and validated with biomarkers of risk behaviors to be collected at the end of the study period using a rapid oral HIV test and drug test via nail sample. This research will result in a subsequent R34 application to develop and test a just-in-time adaptive intervention (JTAI) using machine learning technology. The specific aims of the proposed research are to: (1) Develop and assess the utility of a culturally congruent DCMM to study the SNS use patterns, substance use and HIV risk and protective behaviors of MSM; (2) Determine associations between patterns of technology use, substance use and HIV risk behaviors among a sample of 50 MSM using a culturally congruent DCMM, self-report data collection and biomarkers for substance use and HIV; and (3) Evaluate the feasibility and the computational requirements of a just-in-time adaptive intervention to reduce substance use and HIV risk behavior among MSM. By devising and testing a culturally congruent DCMM to capture SNS data on MSM substance use and sexual partner seeking this study lays the building blocks to developing technology-based substance use and HIV prevention and treatment efforts tailored specifically for MSM.